-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix regression #23969: Add ensureApplied to the quotes reflect API #24160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5a6580c to
2f0d636
Compare
| def a1 = () | ||
| def a2() = () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious about what will happen if we do this?
| def a1 = () | |
| def a2() = () | |
| def a1[T] = () | |
| def a2[T]() = () |
At least, we should include them in the test.
| Select.unique('{TestMethods}.asTerm, "a3").ensureApplied match | ||
| case Select(_, _) => | ||
| case other => assert(false) | ||
| Select.unique('{TestMethods}.asTerm, "a4").ensureApplied match |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmmh, this is a legitimate question, but if we have a transparent inline method, it is subject to type inference, why shouldn't we wrap then in an Apply and let type inference do it's thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will result in:
-- Error: tests/pos-macros/i23969/Main.scala:1:19 ------------------------------
1 |@main def Test() = runMacro()
| ^^^^^^^^^^
| method a4 in object TestMethods does not take parameterserror, thrown from tpd.Apply. Even if we were to change that, we would have to deal with the TreeChecker run right after the macro expansion. In general, I believe we have to return fully typed trees and I am not aware of any additional type inference done to inlined code after inlining it (so it will be done for quoted code before the macro is expanded, or for non-macro inline method contents, but not changed after inlining, even for non-macro transparent inline methods, more info here: #8739).
Also apologies for weird response times! And thank you for looking at this @hamzaremmal
Fixes #23969
The regression would not appear on main (only after release on the nightly version of the compiler, as explained here), so I've adjusted the test to be more general.